//
//  LFHomeWebViewController.m
//  LoveFruit
//
//  Created by 张令林 on 16/9/23.
//  Copyright © 2016年 张令林. All rights reserved.
//

#import "LFHomeWebViewController.h"

@interface LFHomeWebViewController ()

@property (nonatomic,weak) UIWebView *webView;

@end

@implementation LFHomeWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //调用初始化方法
    [self setUpUI];
}

#pragma mark 初始化方法
- (void)setUpUI
{
    
    //添加webView
    UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
    webView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:webView];
    self.webView = webView;
    
    //加载网页
    NSURL *url = [NSURL URLWithString:self.focusModel.toURL];
    //设置标题
    self.title = self.focusModel.name;
    if (url == nil)
    {
        url = [NSURL URLWithString:self.iconModel.customURL];
        //设置标题
        self.title = self.iconModel.name;
    }
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];

}

@end
